package com.zyf.controller.file;

import com.zyf.service.file.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping(value = "/file")
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping(value = "/upload")
    public String upload(@RequestParam("file")MultipartFile file) {
        fileService.upload(file);
        return "执行结束";
    }

    // 分片上传
    @PostMapping(value = "/fragmentUpload")
    public String fragmentUpload(@RequestParam("file")MultipartFile file) {
        fileService.fragmentUpload(file);
        return "执行结束";
    }

    @GetMapping(value = "/download")
    public String download() {
        System.out.println("下载文件");
        System.out.println("12112312");
        return "下载文件...。。";
    }
}
